function [ output_args ] = learn( input_args )

[folder_path] = uigetdir('../stats', 'Load Wrist Stats Data');

sub_folder = dir(folder_path);
for p = 3 : length(sub_folder)
    file_name = dir(fullfile(folder_path, sub_folder(p).name, '*.csv'));
    file_path = fullfile(folder_path, sub_folder(p).name);
    for i = 1 : length(file_name)
        wrist_data =  csvread(fullfile(file_path, file_name(i).name));
        
        time_step = wrist_data(:,1);
        weight = wrist_data(:,2);
        mu = wrist_data(:,3);
        force = wrist_data(:,4:6);
        torque = wrist_data(:,7:9);
        pos = wrist_data(:,10:12);
        quat = wrist_data(:,13:16);
        
        force_collection(i, 1:size(force, 1), 1:size(force, 2)) = force;
        torque_collection(i, 1:size(torque, 1), 1:size(torque, 2)) = torque;
        pos_collection(i, 1:size(pos, 1), 1:size(pos, 2)) = pos;
        quat_collection(i, 1:size(quat, 1), 1:size(quat, 2)) = quat;
    end
    
    force_muhat = zeros(size(force_collection, 2), size(force_collection, 3));
    force_sigmahat = zeros(size(force_collection, 2), size(force_collection, 3));
    force_muci = zeros(size(force_collection, 2), size(force_collection, 3), 2);
    force_sigmaci = zeros(size(force_collection, 2), size(force_collection, 3), 2);
    
    for i = 1 : size(force_collection, 2)
        for j = 1 : size(force_collection, 3)
            force_stack = force_collection(:, i, j);
            [force_muhat(i, j), force_sigmahat(i, j), force_muci(i, j, :), force_sigmaci(i, j, :)] = normfit(force_stack);
        end
    end
    
    torque_muhat = zeros(size(torque_collection, 2), size(torque_collection, 3));
    torque_sigmahat = zeros(size(torque_collection, 2), size(torque_collection, 3));
    torque_muci = zeros(size(torque_collection, 2), size(torque_collection, 3), 2);
    torque_sigmaci = zeros(size(torque_collection, 2), size(torque_collection, 3), 2);
    
    for i = 1 : size(torque_collection, 2)
        for j = 1 : size(torque_collection, 3)
            torque_stack = torque_collection(:, i, j);
            [torque_muhat(i, j), torque_sigmahat(i, j), torque_muci(i, j, :), torque_sigmaci(i, j, :)] = normfit(torque_stack);
        end
    end
    
    pos_muhat = zeros(size(pos_collection, 2), size(pos_collection, 3));
    pos_sigmahat = zeros(size(pos_collection, 2), size(pos_collection, 3));
    pos_muci = zeros(size(pos_collection, 2), size(pos_collection, 3), 2);
    pos_sigmaci = zeros(size(pos_collection, 2), size(pos_collection, 3), 2);
    
    for i = 1 : size(pos_collection, 2)
        for j = 1 : size(pos_collection, 3)
            pos_stack = pos_collection(:, i, j);
            [pos_muhat(i, j), pos_sigmahat(i, j), pos_muci(i, j, :), pos_sigmaci(i, j, :)] = normfit(pos_stack);
        end
    end
    
    quat_muhat = zeros(size(quat_collection, 2), size(quat_collection, 3));
    quat_sigmahat = zeros(size(quat_collection, 2), size(quat_collection, 3));
    quat_muci = zeros(size(quat_collection, 2), size(quat_collection, 3), 2);
    quat_sigmaci = zeros(size(quat_collection, 2), size(quat_collection, 3), 2);
    
    for i = 1 : size(quat_collection, 2)
        for j = 1 : size(quat_collection, 3)
            quat_stack = quat_collection(:, i, j);
            [quat_muhat(i, j), quat_sigmahat(i, j), quat_muci(i, j, :), quat_sigmaci(i, j, :)] = normfit(quat_stack);
        end
    end
    
    
    file_path = fullfile(file_path, '..', 'gaussian');
    
    if ~exist(file_path, 'dir')
        mkdir(file_path);
    end
    
    % csvwrite(fullfile(file_path, 'result', 'force_muhat.csv'), [time_step force_muhat]);
    % csvwrite(fullfile(file_path, 'result', 'force_sigmahat.csv'), [time_step force_sigmahat]);
    %
    % csvwrite(fullfile(file_path, 'result', 'torque_muhat.csv'), [time_step torque_muhat]);
    % csvwrite(fullfile(file_path, 'result', 'torque_sigmahat.csv'), [time_step torque_sigmahat]);
    %
    % csvwrite(fullfile(file_path, 'result', 'pos_muhat.csv'), [time_step pos_muhat]);
    % csvwrite(fullfile(file_path, 'result', 'pos_sigmahat.csv'), [time_step pos_sigmahat]);
    %
    % csvwrite(fullfile(file_path, 'result', 'quat_muhat.csv'), [time_step quat_muhat]);
    % csvwrite(fullfile(file_path, 'result', 'quat_sigmahat.csv'), [time_step quat_sigmahat]);
    
    file_name = ['M_' strrep(num2str(weight(1)), '.', '_') '_F_' strrep(num2str(mu(1)), '.', '_')];
    
    csvwrite(fullfile(file_path, [file_name '_muhat_result.csv']), [time_step weight mu force_muhat torque_muhat pos_muhat quat_muhat]);
    csvwrite(fullfile(file_path, [file_name '_sigmahat_result.csv']), [time_step weight mu force_sigmahat torque_sigmahat pos_sigmahat quat_sigmahat]);
end
end

